
<template>
  <div class="app-container" v-loading="loading">
    <div class="head-container">
      <el-container>
        <el-form
          ref="vForm"
          :model="form"
          label-position="left"
          label-width="60px"
          size="medium"
          @submit.native.prevent
        >
          <el-row :gutter="10">
            <el-col :span="4" class="grid-cell">
              <div class="tip"><div>人员信息</div></div>

              <div style="margin-bottom: 10px;display: flex;align-items: center">
                <el-input placeholder="请输入体检编号" v-model="searchParams.checkCode" clearable class="input-with-select">
                  <el-button slot="append" icon="el-icon-search" @click="SeachCheckcode"></el-button>
                </el-input>
                <div class="more" @click="dialogSearch=true">更多></div>
              </div>

              <div class="tip"><div>科室信息</div></div>
              <el-select
                v-model="groupId"
                filterable
                placeholder="请选择科室"
                style="width: 100%;margin-bottom: 10px"
                @change="chooseGroup($event)">
                <el-option
                  v-for="item in Grouplist"
                  :key="item.id"
                  :label="item.groupName"
                  :value="item.id">
                </el-option>
              </el-select>
              <div class="tip"><div>人员列表</div></div>
              <el-table
                ref="multiplePersonTable"
                border
                stripe
                :data="DataPersonlist"
                highlight-current-row
                max-height="500"
                @row-click="handleClickPerson"
              >
                <el-table-column type="index" label="No." :width="45" />
                <el-table-column
                  v-for="col in Personlist"
                  :key="col.prop"
                  :prop="col.prop"
                  :label="col.label"
                  :width="col.width"
                  align="center"
                />
              </el-table>
            </el-col>
            <el-col :span="20" class="grid-cell">
              <br />
              <el-row>
                <el-col :span="4" class="grid-cell">
                  <el-form-item label="" prop="pictureupload92945">
                    <div class="block">
                      <el-image
                        style="width: 85px; height: 100px"
                        :src="`data:image/png;base64,${form.headpicture}`"
                        fit="fill"
                      />
                    </div>
                  </el-form-item>
                </el-col>
                <el-col :span="20" class="grid-cell">
                  <el-descriptions title="人员信息">
                    <el-descriptions-item label="姓名">{{
                        this.form.name
                      }}</el-descriptions-item>
                    <el-descriptions-item label="性别">
                      <dict-tag :options="dict.type.sys_user_sex" :value="this.form.sex"/>
                    </el-descriptions-item>
                    <el-descriptions-item label="年龄">{{
                        this.form.age
                      }}</el-descriptions-item>
                    <el-descriptions-item label="单位名称">{{
                        this.form.companyName
                      }}</el-descriptions-item>
                    <el-descriptions-item label="在岗状态">
                      <dict-tag :options="dict.type.dime_physical_work" :value="this.form.workStatus"/>
                    </el-descriptions-item>
                    <el-descriptions-item label="危害因素">{{
                        this.form.touchHarms
                      }}</el-descriptions-item>
                  </el-descriptions>
                </el-col>
              </el-row>
              <el-row style="margin-right: 26px">
                <el-col :span="form.dimePhysicalflow.type=='06'? 17 : 24">
                  <div class="table-container">
                    <el-table
                      ref="GroupTable"
                      border
                      stripe
                      :data="form.inputItemList"
                      max-height="600px"
                      size="small"
                      style="width: 99%"
                      @cell-click="cellClick"
                    >
                      <el-table-column
                        :prop="SubscolumnList[0].prop"
                        :label="SubscolumnList[0].label"
                        align="center"
                        width="180"
                      />
                      <el-table-column
                        :prop="SubscolumnList[1].prop"
                        :label="SubscolumnList[1].label"
                        align="center"
                      >
                        <template scope="scope">
                          <el-input
                            :ref="'resultInput' + scope.$index"
                            v-model="scope.row.result"
                            v-if="scope.row.seen"
                            @blur="loseFcous(scope.$index, scope.row)"
                            @dblclick.native="selectEntry(scope.row)"
                            @keydown.enter.native="keydownEnter(scope.$index)"
                          ></el-input>
                          <span style="margin-left: 10px" v-else>{{
                              scope.row.result
                            }}</span>
                        </template>
                      </el-table-column>
                      <el-table-column
                        :prop="SubscolumnList[2].prop"
                        :label="SubscolumnList[2].label"
                        align="center"
                      />
                      <el-table-column
                        :prop="SubscolumnList[3].prop"
                        :label="SubscolumnList[3].label"
                        align="center"
                      >
                        <template scope="scope">
                          <el-checkbox v-model="scope.row.passTag" :true-label="1" :false-label="0"
                                       @change="passChange(scope.row)"
                          >合格</el-checkbox
                          >
                        </template>
                      </el-table-column>
                      <el-table-column
                        :prop="SubscolumnList[4].prop"
                        :label="SubscolumnList[4].label"
                        align="center"
                      />

                      <el-table-column
                        :prop="SubscolumnList[5].prop"
                        :label="SubscolumnList[5].label"
                        align="center"
                      >
                        <template scope="scopelack">
                          <el-checkbox
                            v-model="scopelack.row.lack"
                            @change="lackChange(scopelack.row)"
                          >缺检</el-checkbox
                          >
                        </template>
                      </el-table-column>
                      <el-table-column
                        :prop="SubscolumnList[6].prop"
                        :label="SubscolumnList[6].label"
                        align="center"
                      >
                        <template slot-scope="scope">
                          {{computeCorrectionValue(scope.row)}}
                        </template>
                      </el-table-column>
                    </el-table>
                  </div>
                  <div style="margin-top: 16px; width: 99%">
                    <el-form-item label="小结" class="required" prop="conclusion">
                      <el-input
                        v-model="form.dimePhysicalconsion.conclusion"
                        type="textarea"
                        :rows="3"
                        clearable
                      />
                    </el-form-item>
                  </div>
                </el-col>
                <el-col :span="7" v-show="form.dimePhysicalflow.type=='06'">
                  <div id="leftChart" ref="leftChart" style="width: 470px;height: 470px;margin-top: -30px"></div>
                  <div id="rightChart" ref="rightChart" style="width: 470px;height: 470px;margin-top: -30px"></div>
                </el-col>
              </el-row>

            </el-col>
          </el-row>
        </el-form>
      </el-container>
      <el-dialog
        :visible.sync="dialogFormVisible"
        :close-on-click-modal="false"
        :title="formTitle"
        style="margin-top: -50px"
        @close="cancel()"
      >
        <el-table
          :data="
            EntryDataData.filter(
              (data) => !search || data.description.includes(search)
            )
          "
          style="width: 90%"
          height="600px"
          @selection-change="handleEntrySelectionChange"
        >
          <el-table-column type="selection" width="44px" />
          <el-table-column label="词条描述" prop="describe" width="500px">
          </el-table-column>
          <el-table-column label="合格标记" width="100px">
            <template scope="scope">
              <el-checkbox v-model="scope.row.passTag" :true-label="1" :false-label="0"
              >合格</el-checkbox
              >
            </template>
          </el-table-column>

          <el-table-column align="center">
            <template slot="header" slot-scope="scope">
              <el-input
                v-model="search"
                size="mini"
                placeholder="输入关键字搜索"
              />
            </template>
          </el-table-column>
        </el-table>
        <div
          slot="footer"
          align="right"
          style="margin-top: 10px; margin-right: 80px"
        >
          <el-button size="medium" type="primary" @click="entrysave"
            >确认</el-button
          >
        </div>
      </el-dialog>
    </div>
    <div
      slot="footer"
      align="right"
      style="padding: 10px 10px 0 0"
      v-if="form.dimePhysicalflow.flowStatus!== ''"
    >
      <el-button size="medium" type="text" @click="resetForm('form')"
        >重置</el-button
      >

      <el-button size="medium" type="danger" @click="revokeForm" v-if="form.dimePhysicalflow.flowStatus==1"
        >撤销</el-button
      >
      <el-button
        v-if="form.dimePhysicalflow.flowStatus==0"
        v-loading="formLoading"
        size="medium"
        type="primary"
        @click="submitForm"
        >确定</el-button
      >
    </div>
    <el-dialog
      :visible.sync="dialogSearch"
      title="更多搜索条件"
      @close="dialogSearch=false"
      width="600px"
    >
      <el-form :model="searchParams" ref="searchForm" label-position="right" label-width="80px">
        <el-form-item label="体检编号" prop="checkCode">
          <el-input
            v-model="searchParams.checkCode"
            placeholder="请输入体检编号"
            clearable
          />
        </el-form-item>
        <el-form-item label="登记日期" prop="registerDate">
          <el-date-picker
            style="width: 100%"
            v-model="registerDate"
            type="daterange"
            value-format="yyyy-MM-dd"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="体检日期" prop="physicalDate">
          <el-date-picker
            style="width: 100%"
            v-model="physicalDate"
            type="daterange"
            value-format="yyyy-MM-dd"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="单位名称" prop="companyName">
          <el-input
            v-model="searchParams.companyName"
            placeholder="请输入单位名称"
            clearable
          />
        </el-form-item>
        <el-row>
          <el-col :span="12">
            <el-form-item label="体检类型" prop="checkType">
              <el-select v-model="searchParams.checkType" placeholder="请选择体检类型">
                <el-option
                  v-for="dict in dict.type.dime_physical_type"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="在岗状态" prop="workStatus">
              <el-select v-model="searchParams.workStatus" placeholder="请选择在岗状态" clearable>
                <el-option
                  v-for="dict in dict.type.dime_physical_work"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>

      <div align="right" style="margin-top:20px">
        <el-button icon="el-icon-refresh" size="medium" @click="resetSearch"
        >重置</el-button
        >
        <el-button
          icon="el-icon-search"
          size="medium"
          type="primary"
          @click="handleSearch"
        >确认</el-button
        >
      </div>
    </el-dialog>
  </div>
</template>
<script>
import * as echarts from 'echarts'
import TablecolumnList from "../tablecolumn.js";
import { getGroup,getRegisters,getInputResult,saveInput,cancelInputResult,getInputByCheckcode } from '@/api/physical/physicalinput'

const defaultForm = {
  "dimePhysicalconsion": {
   "conclusion": "",
    "dimeBasegroupid": "",
    "id": "",
    "params": {},
    "passTag": "",
    "physicalRegisterId": "",
    "remark": "",
},
  "dimePhysicalflow": {
    "flowStatus": "",
  },
  "inputItemList": []
};

export default {
  dicts: ['sys_user_sex','dime_physical_work','dime_physical_type'],
  components: {},
  props: {},
  data() {
    return {
      registerDate:'',
      physicalDate:'',
      searchParams:{
        checkCode:'',
        registerbegineDate:'',
        registerendDate:'',
        physicalbegineDate:'',
        physicalendDate:'',
        companyName:'',
        checkType:'',
        workStatus:''
      },
      dialogSearch: false,
      loading:false,
      checkCode:'',
      conclusion:'',
      groupId:'',
      physicalId:'',
      formData: {
        pictureupload92945: null,
        input120175: "",
      },
      Grouplist: [],
      SubsList: [],
      formLoading: false,
      GroupcolumnList: TablecolumnList.GroupcolumnList,
      SubscolumnList: TablecolumnList.SubscolumnList,
      Personlist: TablecolumnList.Personlist,
      form: Object.assign({}, defaultForm),
      dialogFormVisible: false,
      multipleSelection: [],
      itemSelection: [],
      formTitle: "",
      EntryDataData: [],
      search: "",
      DataPersonlist: [],
    };
  },
  computed: {},
  watch: {},
  created() {
    this.getDocDept();
  },
  mounted() {
    this.initCharts()
    this.renderTable()
  },
  methods: {
    resetSearch() {
      this.registerDate='',
        this.physicalDate='',
        this.searchParams={
          checkCode:'',
          registerbegineDate:'',
          registerendDate:'',
          physicalbegineDate:'',
          physicalendDate:'',
          companyName:'',
          checkType:'',
          workStatus:''
        }
    },
    keydownEnter(index) {
      this.$refs['resultInput' + index].blur()
      index++
      if(index < this.form.inputItemList.length) {
        let row = this.form.inputItemList[index]
        this.$set(row, "seen", true);
        this.$nextTick(function () {
          this.$refs['resultInput' + index].focus()
          this.handleitemSelectionChange(row);
        });
      }
    },
    initCharts () {
      this.options = {
        xAxis: {
          name: "频率（Hz）",
          nameLocation: 'center',
          nameGap: 30,
          boundaryGap: false,
          data: ["125", "250", "500", "750", "1k", "1.5k", "2k", "3k", "4k", "6k", "8k"],
          splitLine: {                                //网格线
            show: true,                                  //是否显示
            lineStyle: {                                //网格线样式
              color: '#b4b4b4',                        //网格线颜色
              width: 1,                                //网格线的加粗程度
              type: 'solid'                            //网格线类型
            }
          },
          axisLine: {                                    //坐标轴轴线设置
            show: true,                                  //是否显示坐标轴轴线
            symbol: ['none', 'arrow'],                  //坐标轴箭头        (可选'none'   'arrow'   ['none','arrow'])
            symbolSize: [8, 8],                         //箭头大小        ([宽度,高度])
            symbolOffset: [0, 7],                      //箭头偏移
            lineStyle: {                                //坐标轴的线
              color: 'gray',                            //线的颜色
              width: 2,                                //线的粗细程度    (用数字表示)
              type: 'solid',                            //线的类型        (可选solid  dotted  dashed)
              opacity:1                                //线的透明度        (用0~1的小数表示)
            }
          },
          axisTick: {                                    //坐标轴刻度设置
            show: true,                                  //是否显示坐标轴刻度
            inside: true,                              //坐标轴刻度指向        (true表示向上   false表示向下)
            alignWithLabel:true,                        //刻度线是否和标签对齐
            length: 5,                                 //坐标轴刻度长度
            lineStyle: {                                //坐标轴刻度的样式
              color: 'gray',                            //坐标轴刻度的颜色
              width: 2,                                //坐标轴刻度的粗细程度    (用数字表示)
              type: 'solid'                            //坐标轴刻度的类型        (可选solid  dotted  dashed)
            },
          },
        },
        yAxis: {
          name: "听力水平",
          nameLocation: 'center',
          nameGap: 30,
          min: -10,
          max: 120,
          interval: 10,
          inverse: true
        },
        series: [
          {
            symbol: 'emptyCircle',
            symbolSize: '7',
            data: [],
            connectNulls: true,
            type: 'line',
            itemStyle: {
              color: "#ff0909"
            }
          }
        ]
      };
      this.chart1 = echarts.init(this.$refs.leftChart)
      this.chart2 = echarts.init(this.$refs.rightChart)
      this.options.yAxis.name = '左耳听力水平'
      this.options.series[0].symbol = 'emptyCircle'
      this.options.series[0].symbolSize = '7'
      this.options.series[0].itemStyle.color = '#ff0909'
      this.chart1.setOption(this.options)
      this.options.yAxis.name = '右耳听力水平'
      this.options.series[0].symbol = 'image://'+ require('../../assets/images/fork.png')
      this.options.series[0].symbolSize = '12'
      this.options.series[0].itemStyle.color = '#0854d8'
      this.chart2.setOption(this.options)
    },
    computeCorrectionValue(row) {
      if(row.dimeBaseitemextend && row.result) {
        let result = parseFloat(row.result)
        let num =  result - row.dimeBaseitemextend.correctionvalue
        if(isNaN(num)) return ''
        row.specialresult = num
        return num
      }
      return row.result
    },
    SeachCheckcode() {
      this.handleSearch()
    },
    handleSearch(){
      this.searchParams.registerbegineDate=this.registerDate[0]
      this.searchParams.registerendDate=this.registerDate[1]
      this.searchParams.physicalbegineDate=this.physicalDate[0]
      this.searchParams.physicalendDate=this.physicalDate[1]
      this.loading=true
      getGroup(this.searchParams).then(response => {
        this.Grouplist = response.data.inputGroupList;
        this.DataPersonlist=response.data.dimePhysicalregisterList
        this.dialogSearch=false
      }).finally(()=>{
        this.loading=false
      });
    },
    getDocDept() {
      this.loading=true
      getGroup().then(response => {
        this.Grouplist = response.data.inputGroupList;
        this.DataPersonlist=response.data.dimePhysicalregisterList
      }).finally(()=>{
        this.loading=false
      });
    },
    submitForm() {
      // this.$refs['vForm'].validate(valid => {
      //   if (!valid) return

      //   // TODO: 提交表单
      // })
      this.formLoading = true;
      if (
        this.form.dimePhysicalconsion.conclusion == "" ||
        this.form.dimePhysicalconsion.conclusion == undefined
      ) {
        this.formLoading = false;
        this.$notify({
          title: "警告",
          message: "请输入小结",
          type: "warning",
          duration: 2000,
        });
        return;
      }
      this.UpdateForm(false);
    },

    revokeForm() {
      this.$confirm("确定是否撤销", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.UpdateForm(true);
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },

    UpdateForm(Cancel) {
      let files = []
      const canvas = document.getElementsByTagName('canvas')
      for(let i = 0; i < canvas.length; i++) {
        let image = canvas[i].toDataURL({
          type: 'png',
          pixelRatio: 2,
          backgroundColor: 'white'
        })
        files.push(image)
      }

      this.form.dimePhysicalconsion.dimeBasegroupid=this.groupId
      this.form.dimePhysicalconsion.physicalRegisterId=this.physicalId
        if (Cancel) {
          cancelInputResult(this.groupId,this.physicalId).then(response => {
            this.$notify({
              title: "成功",
              message: "撤销成功",
              type: "success",
              duration: 2000,
            });
            this.form.dimePhysicalflow.flowStatus=0
          })
        } else {
          this.form.files = files
          this.formLoading = true;
          saveInput(this.form).then(response => {
            this.$notify({
              title: "成功",
              message: "更新成功",
              type: "success",
              duration: 2000,
            });
            this.getResult()
          }).finally(()=>{
            this.formLoading = false;
          });
        }
    },

    resetForm() {
      this.form.dimePhysicalconsion.conclusion=''
      this.form.inputItemList.forEach(item => {
         item.result=''
         item.passTag=0
      })
      this.initCharts()
    },

    handleEntrySelectionChange(val) {
      this.multipleSelection = val;
    },
    handleitemSelectionChange(val) {
      this.itemSelection = val;
    },
    getResult(){
      this.loading=true
      getInputResult(this.groupId,this.physicalId).then(response => {
       this.form.dimePhysicalconsion.conclusion=''
       if(response.data.dimePhysicalconsion){
          this.form.dimePhysicalconsion=response.data.dimePhysicalconsion
        }
       if(!response.data.dimePhysicalflow) {
         response.data.dimePhysicalflow = {}
       }
        this.form.dimePhysicalflow=response.data.dimePhysicalflow
        this.form.inputItemList=response.data.inputItemList
        if(this.form.inputItemList){
          this.form.inputItemList.forEach((item) => {
            item.lack = JSON.parse(item.lack)
          })
          this.renderTable()
          this.calFormular()
        }
      }).finally(()=>{
        this.loading=false
      });
    },
    chooseGroup(id) {
      this.groupId=id
      getRegisters(this.groupId).then(response => {
        this.DataPersonlist=response.data.dimePhysicalregisterList
      })
      this.getResult()
    },
    handleClickPerson(val){
      this.form = Object.assign(defaultForm, val);
      this.physicalId=val.id
      this.getResult()
    },
    loseFcous(index, row) {
      row.seen = false;
      this.editResulttag(row);
      this.renderTable()
      this.calFormular(index)
    },
    renderTable() {
      //["125", "250", "500", "750", "1k", "1.5k", "2k", "3k", "4k", "6k", "8k"]
      //500,1k,2k,3k,4k,6k
      if(!this.form.inputItemList || this.form.inputItemList.length < 12) return
      let data1 = [null, null, this.handleResult(this.form.inputItemList[0].result)
        , null, this.handleResult(this.form.inputItemList[1].result), null
        , this.handleResult(this.form.inputItemList[2].result)
        , this.handleResult(this.form.inputItemList[3].result)
        , this.handleResult(this.form.inputItemList[4].result)
        , this.handleResult(this.form.inputItemList[5].result), null]
      let data2 = [null, null, this.handleResult(this.form.inputItemList[6].result)
        , null, this.handleResult(this.form.inputItemList[7].result), null
        , this.handleResult(this.form.inputItemList[8].result)
        , this.handleResult(this.form.inputItemList[9].result)
        , this.handleResult(this.form.inputItemList[10].result)
        , this.handleResult(this.form.inputItemList[11].result), null]
      this.options.series[0].data = data1
      this.options.yAxis.name = '左耳听力水平'
      this.options.series[0].symbol = 'emptyCircle'
      this.options.series[0].symbolSize = '7'
      this.options.series[0].itemStyle.color = '#ff0909'
      this.chart1.setOption(this.options)
      this.options.yAxis.name = '右耳听力水平'
      this.options.series[0].data = data2
      this.options.series[0].symbol = 'image://'+ require('../../assets/images/fork.png')
      this.options.series[0].symbolSize = '12'
      this.options.series[0].itemStyle.color = '#0854d8'
      this.chart2.setOption(this.options)
    },
    calFormular(index = 0) {
      if(index >= 12) return
      if(!this.form.inputItemList) return
      this.form.inputItemList.forEach(item=>{
        let formula = item.formula
        if(!formula) return
        for(let i = 0; i < this.form.inputItemList.length; i++) {
          let key = eval(`/\\[${i}\\]/g`);
          let value = parseFloat(this.form.inputItemList[i].result)
          if(isNaN(value)) value = 0
          formula = formula.replace(key, value)
        }
        this.$set(item, 'result', parseInt(eval(formula)))
        this.handleitemSelectionChange(item)
        this.AutoJudge();
      })

    },
    handleResult(result) {
      result = parseFloat(result)
      if(isNaN(result)) return null
      return result
    },
    lackChange(row) {
      if (row.lack) {
        row.result = "缺检";
        row.passTag = 0;
      } else {
        row.result = "";
        row.passTag = 0;
      }
      this.renderTable()
    },
    passChange(row){
     if(row.passTag==1){
       row.lack=false
     }else{
       this.BulidConsion();
     }
    },
    cellClick(row, column, cell, event) {
      // const flag = this.isAuth('sys:user:edit') // 判断是否有编辑权限
      if (column.label === "检查结果") {
        this.$set(row, "seen", true);
        this.$nextTick(function () {
          const input = cell.querySelector(".el-input__inner");
          input.focus();
          this.handleitemSelectionChange(row);
        });
      }
    },
    editResulttag(row) {

      if (row.result != "" && row.result != undefined) {
        this.AutoJudge();
        this.BulidConsion();
      }else{
        this.itemSelection.passTag=0
        this.itemSelection.lack=false
      }
    },
    selectEntry(val) {
      if(val.dimeBaseitemdescribeList.length>0&&val.judgeType== "0"){
        this.EntryDataData = val.dimeBaseitemdescribeList
        this.dialogFormVisible = true;
      }
    },
    entrysave() {
      this.itemSelection.result = this.multipleSelection
        .map((t) => {
          return t.describe;
        })
        .join(",");
      this.dialogFormVisible = false;
      this.AutoJudge();
      this.BulidConsion();
    },

    AutoJudge() {
      if (this.itemSelection.judgeType == "0") {
        let lisTag = this.multipleSelection.map((t) => {
          return t.pass;
        });
        if (lisTag != undefined && lisTag.length > 0 && lisTag.includes("0")) {
          this.itemSelection.passTag=0
          this.itemSelection.lack=false
        } else {
          this.itemSelection.passTag=1
          this.itemSelection.lack=false
        }
      } else if (this.itemSelection.judgeType == "1") {
        if(isNaN(parseFloat(this.itemSelection.result))) {
          this.itemSelection.passTag=0
          this.itemSelection.lack=false
        } else if (
          this.itemSelection.result != "" &&
          (parseFloat(this.itemSelection.result) > parseFloat(this.itemSelection.valmax) ||
            parseFloat(this.itemSelection.result) < parseFloat(this.itemSelection.valmin))
        ) {
          this.itemSelection.passTag=0
          this.itemSelection.lack=false
        } else {
          this.itemSelection.passTag=1
          this.itemSelection.lack=false
        }
      }

    },

    BulidConsion() {
      if (
        this.form.dimePhysicalconsion != null &&
        this.form.inputItemList != null
      ) {
        let subtables = this.form.inputItemList;
        if(subtables.filter((x) => x.passTag == 1).length
          == subtables.length) {
          this.form.dimePhysicalconsion.conclusion = '未见明显异常'
          return
        }
        if (
          subtables.filter((x) => x.result == "" || x.result == null).length > 0
        ) {
          return;
        }

        this.conclusion = subtables
          .filter((x) => x.passTag == 0)
          .map((x) => {
            return "※" + x.itemName + ":" + x.result;
          })
          .join(";");
        this.form.dimePhysicalconsion.conclusion = this.conclusion;
      }
    },

    cancel() {
      // this.form = Object.assign({}, defaultForm)
      // this.$refs.form.clearValidate()
      this.dialogFormVisible = false;
    },
  },
};
</script>

<style lang="scss" scoped>
.head-container{
  padding-right: 10px;
  height: calc(100vh - 180px);
  overflow-y: auto;
}
div.table-container {
  table.table-layout {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;

    td.table-cell {
      display: table-cell;
      height: 36px;
      border: 1px solid #e1e2e3;
    }
  }
}
div.tab-container {
}

.label-left-align ::v-deep .el-form-item__label {
  text-align: left;
}

.label-center-align ::v-deep .el-form-item__label {
  text-align: center;
}

.label-right-align ::v-deep .el-form-item__label {
  text-align: right;
}
.custom-label {
}

.static-content-item {
  min-height: 20px;
  display: flex;
  align-items: center;
  ::v-deep .el-divider--horizontal {
    margin: 0;
  }
}

.tip {
  padding: 10px 10px;
  background-color: #ecf8ff;
  border-radius: 4px;
  border-left: 5px solid #50bfff;
  margin: 5px 0;
}
.more{
  font-size: 12px;
  color: #1890ff;
  margin-left: 4px;
  white-space: nowrap;
  cursor:pointer;
}
</style>
